<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Add User Information</title>
    <style>
    body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    }

    h1 {
    text-align: center;
    color: #333;
    }

    form {
    max-width: 600px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    }

    label,
    input,
    select,
    textarea {
    display: block;
    margin-bottom: 15px;
    }

    input,
    select,
    textarea {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 5px;
    }

    button {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    }

    button:hover {
    background-color: #45a049;
    }
    </style>


</head>
<body>

<h1>Add LoanProduct Information</h1>
<form action="/mananger/loanProductMessageAdd" method="post">
    <label for="productName">产品名称</label>
    <input type="text" id="productName" name="productName" required><br>

    <label for="beginDate">贷款起始日期:</label>
    <input type="date" id="beginDate" name="beginDate" required><br>

    <label for="timeContinue">贷款期限:</label>
    <input type="text" id="timeContinue" name="timeContinue" required><br>

    <label for="incomeType">贷款类型:</label>
    <select id="incomeType" name="incomeType" required>
        <option value="1">等额本金</option>
        <option value="2">等额本息</option>
    </select><br>

    <label for="beginMoney">贷款金额:</label>
    <input type="text" id="beginMoney" name="beginMoney" required><br>

    <label for="loanRate">利率:</label>
    <input type="text" id="loanRate" name="loanRate" required><br>

    <label for="interest">利息:</label>
    <input type="text" id="interest" name="interest" required>



    <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">Submit</button>
</form>
<script>
    layui.use(['form'], function () {
        var form = layui.form;
        var layer = layui.layer;
        var $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            console.log("data--->>>", data);
            var jsData = data.field;
            $.ajax({
                url: "/mananger/loanProductMessageAdd",
                type: "post",
                data: jsData,
                success: function (result) {
                    if (result.code == 0) {
                        layer.alert("更新成功", {icon: 6}, function () {
                            //关闭当前frame
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            // 可以对父窗口进行刷新
                            parent.location.reload();
                        });
                    } else {

                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.location.reload();
                        layer.msg("更新成功")
                    }
                }
            })

            return false;
        });
    });

</script>

</body>
</html>